home *** CD-ROM | disk | FTP | other *** search
- #ifndef __CTYPE__
- #include <CType.h>
- #endif
-
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
-
- #ifndef __STDIO__
- #include <StdIO.h>
- #endif
-
- #ifndef __GESTALTEQU__
- #include <GestaltEqu.h>
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #define TRUE 0xFF
- #define FALSE 0
-
-
- // check to see if a given trap is implemented. We follow IM VI-3-8.
- Boolean TrapAvailable(short theTrap)
- {
- TrapType theTrapType;
- short numToolboxTraps;
-
- if ((theTrap & 0x0800) > 0)
- theTrapType = ToolTrap;
- else
- theTrapType = OSTrap;
-
- if (theTrapType == ToolTrap)
- {
- theTrap = theTrap & 0x07ff;
- if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xaa6e, ToolTrap))
- numToolboxTraps = 0x0200;
- else
- numToolboxTraps = 0x0400;
- if (theTrap >= numToolboxTraps)
- theTrap = _Unimplemented;
- };
-
- return (NGetTrapAddress(theTrap, theTrapType) != NGetTrapAddress(_Unimplemented, ToolTrap));
- }
-
-
- main()
- {
- OSErr err;
- long feature;
-
- if (TrapAvailable(_Gestalt)) {
- err = Gestalt(gestaltQuickdrawVersion, &feature);
- if (!err) {
- if ((feature & 0x0f00) == 0x0000)
- printf ("We have Original QuickDraw version 0.%x\n", (feature & 0x00ff));
- else if ((feature & 0x0f00) == 0x0100)
- printf ("We have 8 Bit QuickDraw version 1.%x\n", (feature & 0x00ff));
- else if ((feature & 0x0f00) == 0x0200)
- printf ("We have 32 Bit QuickDraw version 2.%x\n", (feature & 0x00ff));
- else
- printf ("We don't have QD\n");
- }
- else
- printf ("Gestalt err = %i\n",err);
- }
- else
- printf ("No Gestalt\n");
- }